package ws.jdbc.concurrent.driver.sqlserver.tds;

import java.nio.ByteBuffer;

/**
 * Data stream reader.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public abstract class StreamReader {

  /** Data input stream to read the token from. */
  protected ByteBuffer stream;
  /** Number of bytes read by this stream reader. */
  protected int bytesRead = 0;

  /**
   * Create a new reader instance.
   *
   * @param stream data input stream to read the token from.
   */
  protected StreamReader(ByteBuffer stream) {
    assert stream != null;
    this.stream = stream;
  }

  /**
   * Get the total number of bytes read up to now.
   *
   * @return total number of bytes read.
   */
  public int getBytesRead() {
    return bytesRead;
  }
}
